﻿#-------------------------------------------------------------------------------
# Name:        ElementsFinder
# Purpose:
#
# Author:      evob0413
#
# Created:     11.07.2014
# Copyright:   (c) evob0413 2014
# Licence:     <your licence>
#-------------------------------------------------------------------------------
from PIL import Image
from InformationGatheringConstants import *

# должен вернуть словарь {(element_key : image)}

class ElementsFinder(object):

    def findElement(self, x, y, width, heigth):
        #TODO TEST_SCREEN_FILE_NAME -> SCREEN_FILE_NAME
        screen = Image.open(TEST_SCREEN_FILE_NAME)
        #print screen.size
        element =  screen.crop((x, y, width, heigth))
        #TODO закомментировать сохранение файла
        element.save("test_" + TEST_SCREEN_FILE_NAME, SCREEN_FILE_FORMAT)
        return element

def main():
    finder = ElementsFinder()
    finder.findElement(TEST_LEFT, TEST_UPPER, TEST_RIGHT, TEST_BOTTOM)

if __name__ == '__main__':
    main()
